﻿using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Options;

namespace Three_Red_Dragon_Mvc.Controllers
{
    /// <summary>
    /// 供应商控制台
    /// </summary>
    public class SupplierController : Controller
    {
        private readonly IpAddressesConfig _ipAddressesConfig;

        public SupplierController(IOptions<IpAddressesConfig> ipAddressesConfig)
        {
            _ipAddressesConfig = ipAddressesConfig.Value;
        }
        /// <summary>
        /// 供应商列表
        /// </summary>
        /// <returns></returns>
        public IActionResult SupplierInfo()
        {
            ViewBag.RBACWrite = _ipAddressesConfig.RBACWrite;
            ViewBag.RedDragonWrite = _ipAddressesConfig.RedDragonWrite;
            return View();
        }

        /// <summary>
        /// 新增供应商
        /// </summary>
        /// <returns></returns>
        public IActionResult CreateSupplier()
        {
            ViewBag.RBACWrite = _ipAddressesConfig.RBACWrite;
            ViewBag.RedDragonWrite = _ipAddressesConfig.RedDragonWrite;
            return View();
        }

        /// <summary>
        /// 修改供应商
        /// </summary>
        /// <returns></returns>
        public IActionResult UpdateSupplier()
        {
            ViewBag.RBACWrite = _ipAddressesConfig.RBACWrite;
            ViewBag.RedDragonWrite = _ipAddressesConfig.RedDragonWrite;
            return View();
        }
    }
}
